﻿namespace Common.Helpers
{
    using System.Collections.Generic;
    using Common.Protocol;

    public static class ChannelDispatcher
    {
        private static Dictionary<string, bool> Channels { get; set; }
        
        static ChannelDispatcher()
        {
            ChannelDispatcher.Reset();
        }

        /// <summary>
        /// Activates all channels
        /// </summary>
        static public void Reset()
        {
            ChannelDispatcher.Channels = new Dictionary<string, bool>();
            for (int i = 0; i < 32; i++)
            {
                ChannelDispatcher.Channels.Add(Channel.GetIdFromNumber(i), true);
            }
        }

        static public void Activate(string id)
        {
            ChannelDispatcher.Channels[id] = true;
        }

        static public void Deactivate(string id)
        {
            ChannelDispatcher.Channels[id] = false;
        }

        static public bool IsActive(string id)
        {
            return ChannelDispatcher.Channels[id];
        }
    }
}